package cn.com.swu.mianyangapp.ui.message;

import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageButton;
import android.widget.ListView;
import android.widget.TextView;

import java.util.List;

import cn.com.swu.mianyangapp.R;
import cn.com.swu.mianyangapp.bean.Text;

public class SendAdapter extends BaseAdapter {private List<Text> textList;
    private LayoutInflater inflater;

    public SendAdapter(List<Text> textlist, ListView listView){

        this.textList=textlist;
        this.inflater=LayoutInflater.from(listView.getContext());
    }
    @Override
    public int getCount() {
        return textList==null?0:textList.size();
    }
    @Override
    public Object getItem(int position) {
        return textList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup viewGroup) {

        View view=inflater.inflate(R.layout.item_recv,null);
        Text text=(Text)getItem(position);
        System.out.println(text);
        TextView textTitle=(TextView) view.findViewById(R.id.text_Title);
        TextView sendTele=(TextView) view.findViewById(R.id.send_tele);
        TextView recvTime=(TextView)view.findViewById(R.id.recv_time);
        textTitle.setText(text.getTextTitle());
        sendTele.setText(text.getRecvTele());
        recvTime.setText(text.getSendTime());
        return view;
    }



}
